<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{

	protected function _initView()
	{
		$view = new Zend_View();
		$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');

		$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
		$viewRenderer->setView($view);
		Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
		return $view;
	}

	//
	protected function _initDb()
	{
		date_default_timezone_set('Asia/Ho_Chi_Minh');
		$config = new Zend_Config_Ini(APPLICATION_PATH. "/configs/application.ini", 'staging');
		// Setup database
		$db = Zend_Db::factory($config->database);

		//$db->setFetchMode(Zend_Db::FETCH_ASSOC);
//		$db->query("SET NAMES 'utf8'");
//		$db->query("SET CHARACTER SET 'utf8'");
		$db->query("SET time_zone = '+07:00'");
		Zend_Registry::set('connectDB', $db);

		//Khi thiet lap che do nay model moi co the su dung duoc
		Zend_Db_Table::setDefaultAdapter($db);

		// Return it, so that it can be stored by the bootstrap
		return $db;
			
	}
}
